package com.lidy.tankbattle.event.tankgame1;

import com.lidy.tankbattle.tankgame1.constant.TankPriorities;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author lidy
 * @version V1.0
 * @classname Tank
 * @description 坦克父类
 * @date 2022/5/28 13:36
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Tank {
    /**
     * X坐标
     **/
    private int x;
    /**
     * Y坐标
     **/
    private int y;

    /**
     * 速度
    **/
    private int speed = TankPriorities.MY_TANK_INIT_SPEED;

    /**
     * 坦克类型
    **/
    private int type;
    /**
     * 0-上，1-下，2-左，3-右
     **/
    private int direction;

    public Tank(int x, int y, int type, int direction) {
        this.x = x;
        this.y = y;
        this.type = type;
        this.direction = direction;
    }

    public void moveRight() {
        x += speed;
    }

    public void moveLeft() {
        x -= speed;
    }

    public void moveDown() {
        y += speed;
    }

    public void moveUp() {
        y -= speed;
    }
}
